home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3451 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: millenium.texas.net!gcherer
  2. From: gcherer@millenium.texas.net (GT Cherer)
  3. Newsgroups: comp.lang.c
  4. Subject: realloc question
  5. Date: 29 Jan 1996 04:23:39 GMT
  6. Organization: Texas Networking, Inc.
  7. Message-ID: <4ehi4b$qfo@news.texas.net>
  8. NNTP-Posting-Host: millenium.texas.net
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. Dudes-
  12. Whether i am on my old 286 with 1 meg, or on my 486 with 8 meg of ram, i 
  13. get the same result when i do a realloc on about the 50th iteration.( its
  14. on an array of pointers). but, when i compile and run the same program on 
  15. a unix box (with beacoups more memory) it runs with no probs.
  16.  
  17. is there a difference in realloc on a dos machine vs unix box? 
  18. Is there some kind of limiting factor with realloc (other than the amount 
  19. of ram), like a heap or stack size or something?? i follow the realloc 
  20. with a calloc for a  spot to put a small structure so the two lines look 
  21. like this, with the realloc returning a NULL:
  22. x++;
  23. ptr=(struct sumthin**) realloc(ptr,(x+1) * sizeof(struct sumthin));
  24. ptr[x]=(struct sumthin*) calloc(1,sizeof(struct sumthin));
  25.  
  26. Any ideas?? Sure preeeeeciate 'em. TIA
  27. --
  28. G.T. Jeff Cherer gcherer@texas.net
  29. Voice: 210-532-7524 SnailMail: 1132 Vanderbilt St. 78210
  30. "Comfort the afflicted: Afflict the comfortable."
  31.